<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('下载文件')"/>

</head>
<body class="white-bg">
<input name="filePath" id="filePath" type="hidden" th:value="${filePath}"/>
<input name="fileName" id="fileName" type="hidden" th:value="${fileName}"/>
<input name="result" id="result" type="hidden" th:value="${result}"/>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">


    $(function () {
        if($("#result").val() =="fail"){
            $.modal.msgError("用户已取消分享!");
        }else{
            download();
        }

    });

    function download(){
        //     window.location.href =fileUrl
        var elelink = document.createElement("a");
        elelink.style.display = 'none';
        elelink.target = '_blank';
        elelink.href =  $("#filePath").val();
        elelink.download =  $("#fileName").val();
        document.body.appendChild(elelink);
        elelink.click();
        document.body.removeChild(elelink);

    }


</script>
</body>
</html>
